<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加订单详情 - 餐厅管理系统</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: 'Microsoft YaHei', Arial, sans-serif; background: #f5f5f5; }
        .container { max-width: 800px; margin: 0 auto; padding: 20px; }
        .header { background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%); color: white; padding: 30px; border-radius: 10px; margin-bottom: 30px; text-align: center; }
        .form-container { background: white; padding: 40px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
        .form-group { margin-bottom: 25px; }
        .form-group label { display: block; margin-bottom: 8px; color: #333; font-weight: 500; }
        .form-group input, .form-group select { width: 100%; padding: 12px; border: 2px solid #e2e8f0; border-radius: 6px; font-size: 14px; transition: all 0.3s; }
        .form-group input:focus, .form-group select:focus { outline: none; border-color: #9f7aea; box-shadow: 0 0 0 3px rgba(159,122,234,0.1); }
        .form-actions { display: flex; gap: 15px; justify-content: center; margin-top: 30px; }
        .btn { padding: 12px 30px; border: none; border-radius: 6px; cursor: pointer; font-size: 16px; transition: all 0.3s; }
        .btn-primary { background: #9f7aea; color: white; }
        .btn-primary:hover { background: #805ad5; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(159,122,234,0.3); }
        .btn-secondary { background: #718096; color: white; text-decoration: none; display: inline-block; }
        .btn-secondary:hover { background: #4a5568; }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>📝 添加订单详情</h1>
        </div>

        <div class="form-container">
            <form th:action="@{/orderdetails/add}" th:object="${orderDetail}" method="post">
                <div class="form-group">
                    <label for="orderId">选择订单 *</label>
                    <select id="orderId" th:field="*{orderId}" required>
                        <option value="">-- 请选择订单 --</option>
                        <option th:each="order : ${orders}" 
                                th:value="${order.id}" 
                                th:text="'订单ID: ' + ${order.id} + ' (顾客ID: ' + ${order.customerId} + ')'"></option>
                    </select>
                </div>

                <div class="form-group">
                    <label for="menuItemId">选择菜品 *</label>
                    <select id="menuItemId" th:field="*{menuItemId}" required>
                        <option value="">-- 请选择菜品 --</option>
                        <option th:each="menuItem : ${menuItems}" 
                                th:value="${menuItem.id}" 
                                th:text="${menuItem.name + ' - ¥' + menuItem.price}"></option>
                    </select>
                </div>

                <div class="form-group">
                    <label for="quantity">数量 *</label>
                    <input type="number" id="quantity" th:field="*{quantity}" min="1" required placeholder="请输入数量">
                </div>

                <div class="form-actions">
                    <button type="submit" class="btn btn-primary">✅ 保存</button>
                    <a th:href="@{/orderdetails/list}" class="btn btn-secondary">❌ 取消</a>
                </div>
            </form>
        </div>
    </div>
</body>
</html>
